<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="display" uri="http://displaytag.sf.net" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<link href="style/store.css" rel="stylesheet" type="text/css">
<link href="style/displaytagex.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="formName" method="post">
	
	
	<table align="center">
		<tr>
			<td>
				<span class="error" >
					<s:actionerror/>
					<s:actionmessage/>
				</span>
			</td>
		</tr>
	</table>
	<s:if test="dispMode == 1">
	<table align="center" width="35%">
		<tr>
			<td colspan="3" class="verdana" height="30" align="center" bgcolor="#336699">
				<font color="#ffffff">Order Status</font>
			</td>
		</tr>
		<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
			<td><label>Confirmed Order:</label></td>
			<td><s:radio label="Answer" name="ordersanswer" list="#{'NO':'NO','YES':'YES'}" /></td>
			<td><s:submit cssClass="button" value="Submit" action="doGetOrdersAction" ></s:submit>
		</tr>
	</table>
	<br>
	<s:if test="ordersanswer == 'NO' ">
	<table align="center" width="80%">
		<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
			<td>
			<s:set name="ordersList" value="ordersList" scope="request"></s:set>
			<display:table name="ordersList" uid="row" pagesize="10" class="dataTable"
			requestURI="goToOrdersAction.action">
				<display:column title="#"> 
  		  		 ${row_rowNum}
 		 		</display:column>
				<display:column property="oid" title="Order ID"></display:column>
				<display:column title="Delivered To" sortable="true" property="customer.firstname" />
				<display:column property="orderdate" title="Order Date" sortable="true"></display:column>
				<display:column property="ordertime" title="Order Time" sortable="true"></display:column>
				<display:column property="isconfirmed" title="Confirmed" sortable="true"></display:column>
				<display:column property="ordergrandtotal" title="Total Sales"></display:column>
				<display:column>
					<s:url id="view" action="goToViewOrderAction">
						<s:param name="oid" value="#attr.row.oid"></s:param>
					</s:url>
					<s:a href="%{view}">Order Details</s:a>
					&nbsp; | &nbsp;
					<s:url id="confirm" action="confirmOrderAction">
						<s:param name="oid" value="#attr.row.oid"></s:param>
					</s:url>
					<s:a href="%{confirm}" onclick="return confirm('Are you sure?')" >Confirm Order</s:a>
				</display:column>
			<display:setProperty name="paging.banner.placement" value="top" />
		</display:table>
			</td>
		</tr>
	</table>
	</s:if>
	<s:else>
	<table align="center" width="80%">
		<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
			<td>
			<s:set name="ordersList" value="ordersList" scope="request"></s:set>
			<display:table name="ordersList" uid="row" pagesize="10" class="dataTable"
			requestURI="goToOrdersAction.action">
				<display:column title="#"> 
  		  		 ${row_rowNum}
 		 		</display:column>
				<display:column property="oid" title="Order ID"></display:column>
				<display:column title="Delivered To" sortable="true" property="customer.firstname" />
				<display:column property="orderdate" title="Order Date" sortable="true"></display:column>
				<display:column property="ordertime" title="Order Time" sortable="true"></display:column>
				<display:column property="confirmdate" title="Confirm Date" sortable="true"></display:column>
				<display:column property="confirmtime" title="Confirm Time" sortable="true"></display:column>
				<display:column property="isconfirmed" title="Confirmed" sortable="true"></display:column>
				<display:column property="ordergrandtotal" title="Total Sales"></display:column>
				<display:column>
					<s:url id="view" action="goToViewOrderAction">
						<s:param name="oid" value="#attr.row.oid"></s:param>
					</s:url>
					<s:a href="%{view}">Order Details</s:a>
				</display:column>
			<display:setProperty name="paging.banner.placement" value="top" />
		</display:table>
			</td>
		</tr>
	</table>
	</s:else>
	</s:if>
	<s:if test="dispMode == 2">
	<table border="1" align="center" width="50%">
			<tr>
				<td colspan="2" class="verdana" height="30" align="center" bgcolor="#336699"><font color="#ffffff">Order Details</font></td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Order ID: </label></td>
				<td><s:property value="orders.oid" /> </td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Order Date: </label></td>
				<td><s:property value="orders.orderdate" /> </td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Order Time: </label></td>
				<td><s:property value="orders.ordertime" /> </td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Confirm Status: </label></td>
				<td><s:property value="orders.isconfirmed" /> </td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Confirm Date: </label></td>
				<td><s:property value="orders.confirmdate" /> </td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Confirm Time: </label></td>
				<td><s:property value="orders.confirmtime" /> </td>
			</tr>
			<tr>
				<td colspan="2" class="verdana" height="30" align="center" bgcolor="#336699"><font color="#ffffff">Delivered to Customer</font></td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Customer Name: </label></td>
				<td><s:property value="orders.customer.fistname" />&nbsp;<s:property value="orders.customer.lastname" /></td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Customer Address: </label></td>
				<td><s:property value="orders.customer.address" /></td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td><label>Customer Contact Info: </label></td>
				<td>Tel:<s:property value="orders.customer.telephone" />
					&nbsp;Cell:<s:property value="orders.customer.cellphone" />
					&nbsp;Email:<s:property value="orders.customer.email" /></td>
			</tr>
			<tr>
				<td colspan="2" class="verdana" height="30" align="center" bgcolor="#336699"><font color="#ffffff">Purchased Products</font></td>
			</tr>
			<tr>
				<td colspan="2" align="center" width="100%">
					<display:table name="productList" uid="row" pagesize="10" class="dataTable"
						requestURI="goToViewOrderAction.action">
						<display:column property="name" title="Product Name"></display:column>
						<display:column property="quantity" title="Quantity"></display:column>
						<display:column property="subTotal" title="Sub Total"></display:column>
					</display:table>
				</td>
			</tr>
			<tr bgcolor="#e8ecf0" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td width="70%" align="right" style="padding-right: 10px" ><label>Grand Total:</label></td>
				<td><s:property value="orders.ordergrandtotal" /> </td>
			</tr>
			<tr style="font-size: 11px; font-family: Arial, Helvetica, sans-serif" >
				<td colspan="2" align="center"><s:submit action="goToOrdersAction" value="Back" cssClass="button" /></td>
			</tr>
		</table>
	</s:if>
</form>
</body>
</html>